package tpl

const TplDeleteAtom = `
package {{.packageName}};

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.psbc.cbcbp.base.inner.InnerReqDTO;
import com.psbc.cbcbp.base.inner.InnerRespDTO;
import {{.interfaceType}};
import {{.inputParameter}};
import {{.outputParameter}};
import {{.mapper}};
import {{.model}};
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class {{.atomName}} implements {{.interfaceTypeName}}<{{.outputParameterName}}, {{.inputParameterName}}> {
    @Autowired
    private {{.mapperName}} mapper;

     @Override
    public InnerRespDTO<{{.outputParameterName}}> doAtom(InnerReqDTO<{{.inputParameterName}}> reqDTO) {
        InnerRespDTO<{{.outputParameterName}}> respDTO = new InnerRespDTO<>();
        respDTO.setCode("000000000");
        respDTO.setMsg("success");
        try {
            {{.outputParameterName}} data = new {{.outputParameterName}}();
            data.set{{.dataName}}(doWrapper(reqDTO));
            respDTO.setData(data);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            respDTO.setCode("111111111");
            respDTO.setMsg("failed");
        }

        return respDTO;
    }

    /**
     * DELETE
     * @param reqDTO
     * @return
     */
    private int doWrapper(InnerReqDTO<{{.inputParameterName}}> reqDTO) {
        UpdateWrapper<{{.modelName}}> wrapper = new UpdateWrapper<>();
        {{.wrapper}}
        return mapper.delete(wrapper);
    }


}
`
